#define _CRT_SECURE_NO_WARNINGS
#include<vector>
using namespace std;
class Solution
{
public:
    int removeDuplicates(vector<int>& nums)
    {
        int dest = 0;
        int cur = 0;
        while (cur < nums.size()-1)
        {
            while (cur < nums.size() && nums[cur] == nums[dest])
            {
                cur++;
            }
            dest++;
            nums.erase(nums.begin() + dest, nums.begin() + cur);
            cur = dest;
        }
        return nums.size();
    }
};
int main()
{
    vector<int>v;
    v.push_back(0);
    v.push_back(0);
    v.push_back(1);
    v.push_back(1);
    v.push_back(1);
    v.push_back(2);
    v.push_back(2);
    v.push_back(3);
    v.push_back(3);
    v.push_back(4);
    Solution().removeDuplicates(v);
}